Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@turf/projection
Advanced tools
@turf/projection is a module within the Turf.js library that provides functionality for projecting geographical coordinates. It allows for the conversion of coordinates between different coordinate reference systems (CRS), which is essential for various geospatial analyses and visualizations.
toMercator
Converts a GeoJSON object from geographic coordinates (longitude, latitude) to Mercator (x, y) coordinates.
const turf = require('@turf/turf');
const point = turf.point([-75.343, 39.984]);
const projected = turf.toMercator(point);
console.log(projected);
toWgs84
Converts a GeoJSON object from Mercator (x, y) coordinates to geographic coordinates (longitude, latitude).
const turf = require('@turf/turf');
const point = turf.point([0, 0]);
const projected = turf.toWgs84(point);
console.log(projected);
Proj4 is a JavaScript library for converting coordinates between different coordinate reference systems. It is highly versatile and supports a wide range of projections. Compared to @turf/projection, proj4 offers more extensive support for various CRS and is often used in more complex geospatial applications.
Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
options
Object? Optional parameters
options.mutate
boolean allows GeoJSON input to be mutated (significant performance increase if true) (optional, default false
)var pt = turf.point([-71,41]);
var converted = turf.toMercator(pt);
//addToMap
var addToMap = [pt, converted];
Returns GeoJSON Projected GeoJSON
Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
options
Object? Optional parameters
options.mutate
boolean allows GeoJSON input to be mutated (significant performance increase if true) (optional, default false
)var pt = turf.point([-7903683.846322424, 5012341.663847514]);
var converted = turf.toWgs84(pt);
//addToMap
var addToMap = [pt, converted];
Returns GeoJSON Projected GeoJSON
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/projection
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf projection module
We found that @turf/projection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.